Ext.define('TS.lib.form.Text', {
    extend: 'Ext.form.field.Text',
    alias : 'widget.text',
	anchor: '95%',
	applyListeners:function(){// WYWALIć to -> poprawne nazwy sie same aplajujom(ą);
		
		var match = Util.attrMatch(this.initialConfig,'on%',['onChange','onEnter']);
		for(x in match){
			typeof match[x] === 'function' && 
				this.on(x.substr(2).toLowerCase(),match[x]);
		}
	},
	initComponent:function(c){
		this.emptyText = this.initialConfig.empty;
		this.allowBlank = this.initialConfig.b || this.initialConfig.allowBlank;
				
		this.callParent(arguments);
		
		var me = this;

		this.on('specialkey', function(f,o){
			if(o.keyCode == 13){	
				var fn = me.initialConfig.enter || me.initialConfig.onEnter;
				if(typeof fn === 'function'){
					Ext.Function.defer(fn,100);
				} else if(fn){
					if(fn.indexOf('->')>0){
						var fld = fn.split('->')[1],
							place = fn.split('->')[0];
					} else {
						var fld = fn, place = null;
					}
					Ext.Function.defer(Util.fireButton(fld,place),100);
				}
			}
		});
		
		//this.initConfig(c);// WTF??? psuje wszystko 
		
		//this.applyListeners();// tylko blur logowania (8II2012)
				
	},
	allowBlank:false,
	blankText:'To pole jest wymagane.',
	enableKeyEvents:true,
	hideMode:'display'//,
	/* 
	listeners:{// wywalone bo było i tak z automaty nadpisane
	    specialkey: function (f, o) {
	 		log(arguments);log('specialkey');   	
	        if (o.getKey() == 13) {
	        	var form = this.findParentByType('form');
	        	var p_btn = this.previousSibling();
	        	if(typeof C.enter === 'function'){
	        		C.enter(f);
	        	} else if (form && form.buttons && form.buttons.length > 0){
	        		var btn = form.buttons[0];
	        		if(btn && typeof btn.handler === 'function')btn.handler(btn);
	        	} else if (p_btn && p_btn.xtype == 'button'){
	        		// tu powinno byc chyba kliknięcie w przycisk wyszukiwania na toolbarze
	        	} else if (form && typeof form.getTool ==='function' && (tool = form.getTool('save'))){
	        		// to kliknięcie w tool ale mi sie to nie udało, bo trzymane jako element
	        	}
	        }
	        
	    }
	}*/
});
    
    